package com.example;

/**
 * @desc:
 * @author: Shoko
 * @date: 2025/6/1
 */
// 运行状态
class RunningState implements ElevatorState {
    private Elevator elevator;

    public RunningState(Elevator elevator) {
        this.elevator = elevator;
    }

    @Override
    public void moveToFloor(int floor) {
        System.out.println("电梯正在运行中，新目标楼层: " + floor);
        elevator.setDestinationFloor(floor);
    }

    @Override
    public void openDoor() {
        System.out.println("电梯正在运行，不能开门");
    }

    @Override
    public void closeDoor() {
        System.out.println("电梯运行中，门已经关闭");
    }

    @Override
    public void markFault() {
        System.out.println("电梯运行中发生故障，紧急停止");
        elevator.changeState(new FaultState(elevator));
    }

    @Override
    public void fixFault() {
        System.out.println("电梯正在运行，没有故障");
    }
}

